<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        .yellow {
            background-color: lightyellow;
        }

        .green {
            background-color: lightgreen;
        }
    </style>
    <script>
        function changeTrColor() {
            var arr = document.getElementsByTagName("tr");
            for (var i = 1; i < arr.length - 1; i++) {
                if (i % 2 == 0) {
                    arr[i].className = "yellow";
                } else {
                    arr[i].className = "green";
                }
            }
        }

        function dd(x) {
            if (x.checked == true) {
                qx();
            } else {
                qbx();
            }
        }

        function qx() {
            var bg = document.getElementsByName("bg");
            for (var i = 0; i < bg.length; i++) {
                bg[i].checked = true;
            }
        }

        function qbx() {
            var bg = document.getElementsByName("bg");
            for (var i = 0; i < bg.length; i++) {
                bg[i].checked = false;
            }
        }

        function sc() {
            var bg = document.getElementsByName("bg");
            for (var i = 1; i < bg.length - 1; i++) {
                if (bg[i].checked == true) {
                    bg[i].parentNode.parentNode.remove();
                    i--;
                }
            }
        }
    </script>
</head>
<body onload="changeTrColor()">
<table border="1" cellpadding="0" cellspacing="0" width="50%">
    <tr>
        <th><input type="checkbox" name="bg" onclick="dd(this)"/>全选</th>
        <th>发件人</th>
        <th>邮件名称</th>
        <th>邮件附属信息</th>
    </tr>
    <tr>
        <td><input type="checkbox" name="bg"/></td>
        <td>张三11</td>
        <td>我是邮件11</td>
        <td>我是附属信息11</td>
    </tr>
    <tr>
        <td><input type="checkbox" name="bg"/></td>
        <td>张三22</td>
        <td>我是邮件22</td>
        <td>我是附属信息33</td>
    </tr>
    <tr>
        <td><input type="checkbox" name="bg"/></td>
        <td>张三33</td>
        <td>我是邮件33</td>
        <td>我是附属信息33</td>
    </tr>
    <tr>
        <td><input type="checkbox" name="bg"/></td>
        <td>张三44</td>
        <td>我是邮件44</td>
        <td>我是附属信息44</td>
    </tr>
    <tr>
        <th><input type="checkbox" name="bg" onclick="dd(this)"/>全选</th>
        <th><input type="button" value="全选" onclick="qx()"/>
            <input type="button" value="取消全选" onclick="qbx()"/>
            <input type="button" value="反选"/>
            <input type="button" value="删除所选附件" onclick="sc()"/></th>
    </tr>
</table>
</body>
</html>